package org.nanotek.lucene;

//import org.springframework.beans.BeansException;
//import org.springframework.context.ApplicationContext;
//import org.springframework.context.ApplicationContextAware;



public class LuceneIndexService implements IndexService , ApplicationContextAware{

	private ApplicationContext ctx; 
	private String contextServiceRef = "luceneIndexService"; 
	
	public LuceneIndexService() {
	}

	public LuceneIndexService(String contextServiceRef) {
		this.contextServiceRef = contextServiceRef;
	}

	@Override
	public IndexService getIndexService() {
		IndexService ref; 
		assert (ctx !=null); 
		ref = (IndexService) ctx.getBean(contextServiceRef);
		return ref;
	}

	@Override
	public void setApplicationContext(ApplicationContext arg0)
			throws BeansException {
		this.ctx = arg0;
	}

}
